home *** CD-ROM | disk | FTP | other *** search
/ Best of Shareware / Best of PC Windows Shareware 1.0 - Wayzata Technology (7111) (1993).iso / mac / DOS / CAD_CAM / A7221V1B / TERMINAT.C < prev    next >
C/C++ Source or Header  |  1992-03-12  |  2KB  |  63 lines

  1. /*
  2.    Module:  terminat.c
  3.    Date:    3/9/92
  4.    Version: 1.0b
  5.    Author:  Dave Lutz
  6.    Email:   lutz@psych.rochester.edu
  7.    Copyright: 1992 University of Rochester, Psychology Dept.
  8.  
  9.    Disclaimer:  This software is distributed free of charge.  As such, it
  10.                 comes with ABSOLUTELY NO WARRANTY.  The user of the software
  11.                 assumes ALL RISKS associated with its use.
  12.  
  13.                 Your rights to modify and/or distribute this software are
  14.                 outlined in the file ADI7221.DOC.
  15.  
  16.    Purpose: This module provides the function used to terminate the program
  17.             due to an error.
  18.  
  19.    Functions Provided:
  20.  
  21.         terminate
  22.  
  23.    Functions Required:
  24.  
  25.         closein
  26.         closeout
  27. */
  28.  
  29. #include <stdio.h>
  30. #include <stdlib.h>
  31. #include "inout.h"
  32.  
  33.  
  34. /*
  35.    Function: terminate
  36.    Purpose:  terminate the program after an error has occurred.
  37.  
  38.    Pre: exitcode is the code that should be supplied to the exit function.
  39.         infilep is a pointer to a pointer to a PLTFILE. 
  40.         *infilep either points to a PLTFILE that has been opened for reading 
  41.         or is a NULL pointer.
  42.         outfilep is a pointer to a pointer to a PLTFILE.
  43.         *outfilep either points to a PLTFILE that has been opened for writing 
  44.         or is a NULL pointer.
  45.         message is a pointer to an ascii string indicating the type of error
  46.         that occured.
  47.  
  48.    Post:  The string in message is printed to stderr.
  49.           An attempt is made to close *infilep.
  50.           An attempt is made to close *outfilep.
  51.           The program is terminated with the code found in exitcode.
  52. */
  53. void terminate (exitcode, infilep, outfilep, message)
  54.    int exitcode;
  55.    PLTFILE **infilep, **outfilep;
  56.    char *message;
  57. {
  58.    (void) fprintf (stderr, "Fatal error: %s\n",message);
  59.    (void) closein (infilep);
  60.    (void) closeout (outfilep);
  61.    exit (exitcode);
  62. }
  63.